package com.example.stars_project_android.personalCenter;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.stars_project_android.util.Constant;
import com.example.stars_project_android.R;

/**
 * 账号与安全界面
 */
public class IdSafe extends AppCompatActivity {

    private TextView starId, textPhone; //星星编号，手机号
    private ImageView imgBack, imgRight; //点击跳转修改密码

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_id_safe);

        //绑定控件对象
        setView();

        //设置属性
        setData();

        //设置点击事件
        //点击跳转到修改密码界面
        imgRight.setOnClickListener(view->{
            Intent intent = new Intent(this,EditPsd.class);
            startActivity(intent);
        });
        //点击跳转到设置界面
        imgBack.setOnClickListener(view->{
            Intent intent = new Intent(this,SetUp.class);
            startActivity(intent);
        });
    }
    private void setData() {
        starId.setText(Constant.starName);
        //用******替换手机号码中间6位
        String maskNumber = Constant.phone.substring(0,3)+"******"+Constant.phone.substring(9,Constant.phone.length());
        textPhone.setText(maskNumber);
    }

    private void setView() {
        starId = findViewById(R.id.text_star_id);
        textPhone =findViewById(R.id.text_phone);
        imgBack = findViewById(R.id.img_back);
        imgRight = findViewById(R.id.img_right);
    }
}